import { ParamPageParams, ParamPageListGetResultModel } from './model/systemModel';
import { defHttp } from '/@/utils/http/axios';

enum Api {
  ParamPageList = '/admin/param/page',
  InfoParam = '/admin/param',
  ADDParam = '/admin/param/add',
  DelParam = '/admin/param/del',
  UpdateParam = '/admin/param/update',
  ParamKey = '/admin/param/publicValue/',
}

export const getParamKeyApi = (key: string) => defHttp.get<string>({ url: Api.ParamKey + key });

export const getParamListByPage = (params?: ParamPageParams) =>
  defHttp.get<ParamPageListGetResultModel>({ url: Api.ParamPageList, params });

export const addParamApi = (params: ParamPageParams) =>
  defHttp.post<any>({ url: Api.ADDParam, params });

export const updateParamApi = (params: ParamPageParams) =>
  defHttp.post<any>({ url: Api.UpdateParam, params });

export const deleteParamApi = (id: string) => defHttp.post<any>({ url: Api.DelParam + '/' + id });
export const getParamInfoApi = (id: string) => defHttp.get<any>({ url: Api.InfoParam + '/' + id });
